<template>
  <div id="app">
    <keep-alive v-if="keepAlive">
      <router-view />
    </keep-alive>
    <router-view v-else />
  </div>
</template>
<script>
export default {
  name: 'APP',
  data() {
    return {}
  },
  computed: {
    keepAlive() {
      return this.$route.meta.keepAlive
    }
  },
  watch: {
    $route(to, from) {
      if (this.$route.path === '/login') {
        this.$route.meta.keepAlive = true
      } else {
        this.$route.meta.keepAlive = false
      }
      if (to.path === '/userAgreement' && from.path === '/login') {
        this.$route.meta.keepAlive = true
      }
      if (to.path === '/userNotice' && from.path === '/login') {
        this.$route.meta.keepAlive = true
      }
    }
  }
}
</script>
<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  height: 100%;
  width: 100%;
  max-width: 10rem;
  margin: 0 auto;
  /* H5页面选IOS系统滑动卡动问题！ */
  -webkit-overflow-scrolling: touch;
}
</style>
